import 'package:FineArt/utils/size_config.dart';
import 'package:flutter/material.dart';
import 'package:FineArt/constants.dart';

class RoundedButton extends StatelessWidget {
  final String text;
  final Function press;
  final Color color, textColor;
  final Decoration decoration;
  final double width;
  final double height;
  static const  BoxDecoration _boxDecoration=BoxDecoration(

  );
  const
  RoundedButton({
    Key key,
    this.text,
    this.press,
    this.color = kPrimaryColor,
    this.textColor = Colors.white,
    this.decoration= _boxDecoration,
    this.width=0,
    this.height =50,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    var width1 =width;
    if(width ==0){
      width1 =size.width * 0.8;
    }

    return Container(
      width: width1,
      height: getPortraitSHeight(height),
      decoration: decoration,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(29),
        child: FlatButton(
          padding: EdgeInsets.symmetric(vertical: getPortraitSHeight(14), horizontal:getPortraitSWidth(40)),
          color: color,
          onPressed: press,
          child: Text(
            text,
            style: TextStyle(color: textColor),
          ),
        ),
      ),
    );
  }
}
